import 'package:json_annotation/json_annotation.dart';

part 'home_info.g.dart';

@JsonSerializable()
class HomeInfo extends Object {
  @JsonKey(name: 'last_time')
  String lastTime;

  @JsonKey(name: 'sales_region')
  List<SalesRegion> salesRegion;

  @JsonKey(name: 'total_data')
  Zone totalData;

  @JsonKey(name: 'zone_east')
  Zone zoneEast;

  @JsonKey(name: 'zone_south')
  Zone zoneSouth;

  @JsonKey(name: 'zone_west')
  Zone zoneWest;

  @JsonKey(name: 'zone_north')
  Zone zoneNorth;

  @JsonKey(name: 'sale_detail')
  List<SaleDetail> saleDetail;

  @JsonKey(name: 'sale_province')
  List<SaleTop> saleProvince;

  @JsonKey(name: 'sale_city')
  List<SaleTop> saleCity;

  HomeInfo(
    this.lastTime,
    this.salesRegion,
    this.totalData,
    this.zoneEast,
    this.zoneSouth,
    this.zoneWest,
    this.zoneNorth,
    this.saleDetail,
    this.saleProvince,
    this.saleCity,
  );

  factory HomeInfo.fromJson(Map<String, dynamic> srcJson) =>
      _$HomeInfoFromJson(srcJson);

  Map<String, dynamic> toJson() => _$HomeInfoToJson(this);
}

@JsonSerializable()
class SalesRegion extends Object {
  @JsonKey(name: 'nums')
  String nums;

  @JsonKey(name: 'pname')
  String pname;

  SalesRegion(
    this.nums,
    this.pname,
  );

  factory SalesRegion.fromJson(Map<String, dynamic> srcJson) =>
      _$SalesRegionFromJson(srcJson);

  Map<String, dynamic> toJson() => _$SalesRegionToJson(this);
}

@JsonSerializable()
class Zone extends Object {
  @JsonKey(name: 'today_prestige_goods')
  String todayPrestigeGoods;

  @JsonKey(name: 'today_gold_goods')
  String todayGoldGoods;

  @JsonKey(name: 'today_DL_goods')
  String todayDLGoods;

  @JsonKey(name: 'today_immu_goods')
  String todayImmuGoods;

  @JsonKey(name: 'month_order_amount')
  String monthOrderAmount;

  @JsonKey(name: 'shop_number')
  String shopNumber;

  @JsonKey(name: 'lsp_number')
  String lspNumber;

  @JsonKey(name: 'prestige_goods')
  String prestigeGoods;

  @JsonKey(name: 'gold_goods')
  String goldGoods;

  @JsonKey(name: 'DL_goods')
  String dLGoods;

  @JsonKey(name: 'immu_goods')
  String immuGoods;

  @JsonKey(name: 'customer_number')
  String customerNumber;

  //最后三个没用到
  @JsonKey(name: 'prestige_shop_number')
  String prestigeShopNumber;

  @JsonKey(name: 'gold_shop_number')
  String goldShopNumber;

  @JsonKey(name: 'DL_shop_number')
  String dLShopNumber;

  @JsonKey(name: 'today_supreme_goods')
  String todaySupremeGoods;

  @JsonKey(name: 'supreme_goods')
  String supremeGoods;

  Zone(
      this.todayPrestigeGoods,
      this.todayGoldGoods,
      this.todayDLGoods,
      this.todayImmuGoods,
      this.monthOrderAmount,
      this.shopNumber,
      this.lspNumber,
      this.prestigeGoods,
      this.goldGoods,
      this.dLGoods,
      this.immuGoods,
      this.customerNumber,
      this.prestigeShopNumber,
      this.goldShopNumber,
      this.dLShopNumber,
      this.todaySupremeGoods,
      this.supremeGoods);

  factory Zone.fromJson(Map<String, dynamic> srcJson) =>
      _$ZoneFromJson(srcJson);

  Map<String, dynamic> toJson() => _$ZoneToJson(this);
}

@JsonSerializable()
class SaleDetail extends Object {
  @JsonKey(name: 'date')
  String date;

  @JsonKey(name: 'time')
  String time;

  @JsonKey(name: 'shop_name')
  String shopName;

  @JsonKey(name: 'region_address')
  String regionAddress;

  SaleDetail(
    this.date,
    this.time,
    this.shopName,
    this.regionAddress,
  );

  factory SaleDetail.fromJson(Map<String, dynamic> srcJson) =>
      _$SaleDetailFromJson(srcJson);

  Map<String, dynamic> toJson() => _$SaleDetailToJson(this);
}

@JsonSerializable()
class SaleTop extends Object {
  @JsonKey(name: 'region_province')
  String regionProvince;

  @JsonKey(name: 'amount')
  String amount;

  SaleTop(
    this.regionProvince,
    this.amount,
  );

  factory SaleTop.fromJson(Map<String, dynamic> srcJson) =>
      _$SaleTopFromJson(srcJson);

  Map<String, dynamic> toJson() => _$SaleTopToJson(this);
}
